package Socket;

import java.io.*;
import java.net.ServerSocket;
import java.net.Socket;
import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;
import java.util.zip.InflaterInputStream;

public class ServerDemo {
    public static void main(String[] args) {
        new ServerDemo();
    }

    private List<Socket> sockets = new ArrayList<>();

    public ServerDemo() {
        try {
            ServerSocket serverSocket = new ServerSocket( 9988 );//创建服务器与端口号
            System.out.println( "服务器启动" );
            while (true) {
                Socket socket = serverSocket.accept();//accept：接收客户端
                sockets.add( socket );
                new  ServerReceive( sockets,socket ).start();
            }
        } catch (IOException e) {
            e.printStackTrace();
        }
    }
}







